﻿@{
    ViewBag.Title = "Index";
}

<h2>AjaxPost</h2>
@using (Html.BeginForm())
{
    <input type="submit" value="Save" />
}
<p>Construct List of Links</p>
@for (int i = 1; i < 5; i++)
{
    @Html.ActionLink("AjaxPostLink", "AjaxPost", "Ajax", new { id = i.ToString() }, new { @class = "postData" })
    <br />
    <br />
}

<div id="result"></div>
<script type="text/javascript">
    $(".postData").live("click", function (e) {
        e.preventDefault();
        $.ajax({
            url: this.href,
            type: "Post",
            success: function (result) {
                $("#result").html(result);
            }
        });
    });
</script>

